package com.demo.transaction.controller;

import com.demo.transaction.repository.primary.hello.domain.PrimaryHello;
import com.demo.transaction.repository.primary.hello.mapper.PrimaryHelloMapper;
import com.demo.transaction.services.hello.HelloService;
import org.omg.CORBA.INTERNAL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/primary/hello/")
@RestController
public class PrimaryHelloController {


    @Autowired
    PrimaryHelloMapper primaryHelloMapper;

    @RequestMapping("list")
    @ResponseBody
    public List<PrimaryHello> list() {
        return this.primaryHelloMapper.list();
    }

    @RequestMapping("query")
    @ResponseBody
    public PrimaryHello query(Integer id) {
        return this.primaryHelloMapper.get(id);
    }

    @Autowired
    HelloService helloService;

    @RequestMapping("add")
    @ResponseBody
    public String add(){
        this.helloService.add();
        return "success";
    }

}
